<?php

namespace Database\Factories;

use App\Models\Order;
use App\Models\OrderCartInfo;
use Illuminate\Database\Eloquent\Factories\Factory;

class OrderCartInfoFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = OrderCartInfo::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'cart_id' => $this->faker->numberBetween(1, 50),
            'order_id' => $this->faker->randomElement(Order::pluck('id')),
            'product_id' => $this->faker->numberBetween(1, 50),
            'unique' => $this->faker->uuid,
            'cart_info' => [
                [
                    'image_url' => 'http://placeimg.com/40/40/any',
                    'info' => $this->faker->text(20),
                    'num' => $this->faker->numberBetween(1, 5),
                    'price' => $this->faker->randomFloat(2, 100, 999)
                ],
                [
                    'image_url' => 'http://placeimg.com/40/40/any',
                    'info' => $this->faker->text(20),
                    'num' => $this->faker->numberBetween(1, 5),
                    'price' => $this->faker->randomFloat(2, 100, 999)
                ]
            ]
        ];
    }
}
